package com.ipad.net.apistore;

import com.ipad.net.entity.DeliveryContainerEntity;
import com.ipad.net.entity.DeliveryCount;
import com.ipad.net.entity.DeliveryListEntity;
import com.ipad.net.entity.DeliveryListInfoEntity;
import com.ipad.net.entity.ObjectVo;
import com.ipad.net.entity.UpdateEntity;

import java.util.Map;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;

/**
 * Created by Administrator on 2018/12/4.
 */

public interface StoreApi {
    public static final String update_method = "Version.getNew";

    @GET("/")
    Flowable<UpdateEntity> checkVersion(@Query("method") String method,
                                        @Query("data") String data,
                                        @Query("sign") String sign
    );

    /****
     * 配送单列表
     * @param bill_code
     * @param end_create_time
     * @param end_receive_time
     * @param is_same  默认传0   一致：1   不一致：2
     * @param req_warehouse_id  入库库房
     * @param start_create_time
     * @param start_receive_time
     * @param status
     * @param out_warehouse_id
     * @param page
     * @param rows
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("/store/delivery/getDeliveryList")
    Flowable<DeliveryListEntity> getDeliveryList(@Field("bill_code") String bill_code,
                                                 @Field("end_create_time") String end_create_time,
                                                 @Field("end_receive_time") String end_receive_time,
                                                 @Field("is_same") String is_same,
                                                 @Field("req_warehouse_id") String req_warehouse_id,
                                                 @Field("start_create_time") String start_create_time,
                                                 @Field("start_receive_time") String start_receive_time,
                                                 @Field("status") String status,
                                                 @Field("out_warehouse_id") String out_warehouse_id,
                                                 @Field("page") String page,
                                                 @Field("rows") String rows,
                                                 @Field("token") String token);

    @FormUrlEncoded
    @POST("/store/delivery/getDeliveryDetails")
    Flowable<DeliveryListInfoEntity> getDeliveryDetails(@Field("id") String id, @Field("page") String page, @Field("rows") String rows, @Field("token") String token);


    @GET("/store/delivery/getDeliveryCount")
    Flowable<DeliveryCount> getDeliveryCount(@Query("token") String token);

    @Multipart
    @POST("/store/racking/uploadDeliverySignature")
    Flowable<ObjectVo> uploadSign(@PartMap Map<String, RequestBody> map, @Query("id") String id, @Query("container") String container, @Query("billCode") String bill_code, @Query("token") String token);

    //通过容器码获取配送单信息
    @GET("/store/racking/deliveryInfo")
    Flowable<DeliveryContainerEntity> getDeliveryInfoByContainer(@Query("container") String container, @Query("token") String token);
}
